#ifndef __APPLETS_H__
#define __APPLETS_H__

#include "MrvXML.h"

#define DUSTER_CONFIG_START     1
#define DUSTER_CONFIG_STOP      2
#define DUSTER_CONFIG_SET       3
#define DUSTER_CONFIG_GET       4
#define DUSTER_CONFIG_GETLIST   5
#define DUSTER_CONFIG_SETLIST   6

#define DUSTER_CB_ARGS_XML         1
#define DUSTER_CB_ARGS_LIST        2
#define DUSTER_CB_ARGS_STRING      3
#define DUSTER_CB_ARGS_DUMMYDUMMY  4

typedef struct duster_callback_args {
	short         dc_type;
	char         *dc_data;
	void         *dc_opaque;
	MrvXMLElement *dc_root;
} dc_args_t;

struct applet_info {
	char   *di_modname;                      /* The name of the module, also found in the xml tags */
	int     di_version;                      /* The version no. of the module */
	int   (*di_handler_upgrades)(int);       /* Upgrades handler of the module, if the flash version
				               		  * and the di_version differ */
	int   (*di_handler_validate_func)(char *, dc_args_t *);
	int   (*di_handler_pre_set_func)(int, dc_args_t *); /*This callback will invoke before POST pramameters saved into psm*/
	char   *di_handler_pre_set_cmd; /*/ignore in this platform*/
	int   (*di_handler_post_set_func)(int, dc_args_t *); /*This callback will invoke after POST parameters saved into psm*/
	char   *di_handler_post_set_cmd;/*ignore in this platform*/
	int   (*di_handler_pre_get_func)(int, dc_args_t *);/*This callback will invoke in GET request, If save parameter into psm in this handler,the corresponding tags will change in XML for WebUI*/
	char   *di_handler_pre_get_cmd;/*ignore in this platform*/
	int   (*di_handler_post_get_func)(int, dc_args_t *);/*This callback will invoke in GET request, If save parameter into psm in this handler,the corresponding tags will NOT change in XML for WebUI*/
	char   *di_handler_post_get_cmd;/*ignore in this platform*/
	int   (*di_handler_dynamic)(int, int, dc_args_t *);  /* ignore in this platform */
	char    di_rd;                            /* Record Delimiter */
	char    di_fd;                            /* Field Delimiter */
};

/******************************************************************************
*   Register user defined webui page
******************************************************************************/
int web_applet_register(const struct applet_info *applets_p, size_t num_applets);

#endif /* __APPLETS_H__ */
